﻿using System;
using System.Collections;
using Loki.Bot.v2;
using Loki.Game;
using Loki.TreeSharp;
using Loki.Utilities.Plugins;

namespace GetOutOfAmbushChests
{
    public class Main : IPlugin
    {

        #region PluginImplementations

        public void OnInitialize()
        {
            //throw new NotImplementedException();
        }

        public void OnStart()
        {
            Logic = new ActionRunCoroutine(new Func<IEnumerator>(GetBrain), true);
        }

        public void OnPulse()
        {
            //throw new NotImplementedException();
        }

        public void OnStop()
        {
            // throw new NotImplementedException();
        }

        public void OnShutdown()
        {
            // throw new NotImplementedException();
        }

        public void OnEnabled()
        {
            //throw new NotImplementedException();
        }

        public void OnDisabled()
        {
            //throw new NotImplementedException();
        }

        public void OnConfig()
        {
            //throw new NotImplementedException();
        }

        public bool Equals(IPlugin other)
        {
            return Name.Equals(other.Name);
        }

        public string Author { get { return "toNyx"; } }
        public Version Version { get { return new Version("1.0"); } }
        public String Name { get { return "GetOutOfAmbushChests"; } }
        public string Description { get { return ""; } }

        #endregion

        /// <summary>
        /// Defines the brain of the bot
        /// </summary>
        #region brain

        public static MainLogic Brain;

        #endregion

        /// <summary>
        /// Defines a variable for the mainlogic
        /// </summary>
        #region Logic

        public Composite Logic { get; private set; }

        #endregion

        /// <summary>
        /// Returns the mainlogic for the bot aka brain
        /// </summary>
        /// <returns>the brain</returns>
        #region GetBrain

        public IEnumerator GetBrain()
        {
            return Brain ?? (Brain = new MainLogic { Bot = this, MyPlayer = LokiPoe.ObjectManager.Me });
        }

        #endregion
    }
}
